package com.ry.ryshopweb.service;

import com.ry.ryshopweb.vo.*;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service
public class TestOrdersImpl implements TestOrders {
    @Override
    public PageObject<OrderShop> getOrders(Integer pageCurrent) {
        List<OrderShop> list = new ArrayList<>();
        list.add(new OrderShop("111111111111","/img/default.jpg",100l,"测试用户1",1000l,0,1l,new Date(),null));
        list.add(new OrderShop("222222222222","/img/default.jpg",200l,"测试用户2",2000l,1,2l,new Date(),new Date()));
        list.add(new OrderShop("333333333333","/img/default.jpg",300l,"测试用户3",3000l,1,3l,new Date(),new Date()));
        list.add(new OrderShop("444444444444","/img/default.jpg",400l,"测试用户4",4000l,0,4l,new Date(),null));
        list.add(new OrderShop("555555555555","/img/default.jpg",500l,"测试用户5",5000l,1,5l,new Date(),new Date()));
        list.add(new OrderShop("666666666666","/img/default.jpg",600l,"测试用户6",6000l,0,6l,new Date(),null));
        list.add(new OrderShop("777777777777","/img/default.jpg",700l,"测试用户7",7000l,1,7l,new Date(),new Date()));
        list.add(new OrderShop("888888888888","/img/default.jpg",800l,"测试用户8",8000l,1,8l,new Date(),new Date()));
        list.add(new OrderShop("999999999999","/img/default.jpg",900l,"测试用户9",9000l,0,9l,new Date(),null));
        list.add(new OrderShop("000000000000","/img/default.jpg",1000l,"测试用户0",10000l,1,10l,new Date(),new Date()));
        PageObject<OrderShop> pageObject = new PageObject<>(100, list,pageCurrent,10);
        return pageObject;
    }

    @Override
    public OrderItem getOrderItem(String orderId) {
        List<Item> items = new ArrayList<>();
        items.add(new Item(1l,"/pic1","测试商品1",100l,10,10l,"红色"));
        items.add(new Item(2l,"/pic2","测试商品2",200l,15,20l,"绿色"));
        items.add(new Item(3l,"/pic3","测试商品3",300l,12,30l,"黑色"));
        items.add(new Item(4l,"/pic4","测试商品4",400l,11,40l,"宏色"));
        items.add(new Item(5l,"/pic5","测试商品5",500l,12,50l,"蓝色"));
        Address address1 = new Address(1l,"李晓红","123456678901", "广东省某个地区");
        OrderItem o = new OrderItem();
        o.setAddress(address1);
        o.setItem(items);
        o.setOrderId(orderId);
        o.setTotal(1000l);
        o.setUserId(101l);
        o.setUsername("A用户");
        o.setCreated(new Date());
        return o;
    }
}
